home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Technology Seed / August 1998 ADC Seed CD.toast / Mac OS 8.5b2 / allegro-b2-pseudo-SDK / AIncludes / Aliases.a next >
Encoding:
Text File  |  1998-07-17  |  7.7 KB  |  246 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Aliases.a
  3. ;
  4. ;    Contains:    Alias Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    Mac OS 8.1
  7. ;                Release:    Allego Seed, Use with 3.1 Universal Interfaces
  8. ;
  9. ;    Copyright:    © 1989-1995, 1997-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__ALIASES__') = 'UNDEFINED' THEN
  19. __ALIASES__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__APPLETALK__') = 'UNDEFINED' THEN
  25.     include 'AppleTalk.a'
  26.     ENDIF
  27.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  28.     include 'Files.a'
  29.     ENDIF
  30.  
  31.  
  32. rAliasType                        EQU        'alis'                ; Aliases are stored as resources of this type 
  33.  
  34.                                                             ; define alias resolution action rules mask 
  35. kARMMountVol                    EQU        $00000001            ; mount the volume automatically 
  36. kARMNoUI                        EQU        $00000002            ; no user interface allowed during resolution 
  37. kARMMultVols                    EQU        $00000008            ; search on multiple volumes 
  38. kARMSearch                        EQU        $00000100            ; search quickly 
  39. kARMSearchMore                    EQU        $00000200            ; search further 
  40. kARMSearchRelFirst                EQU        $00000400            ; search target on a relative path first 
  41.  
  42.                                                             ; define alias record information types 
  43. asiZoneName                        EQU        -3                    ; get zone name 
  44. asiServerName                    EQU        -2                    ; get server name 
  45. asiVolumeName                    EQU        -1                    ; get volume name 
  46. asiAliasName                    EQU        0                    ; get aliased file/folder/volume name 
  47. asiParentName                    EQU        1                    ; get parent folder name 
  48. ;  ResolveAliasFileWithMountFlags options 
  49.  
  50. kResolveAliasFileNoUI            EQU        $00000001            ; no user interaction during resolution 
  51. ;  define the alias record that will be the blackbox for the caller 
  52. AliasRecord                RECORD 0
  53. userType                 ds.l    1                ; offset: $0 (0)        ;  appl stored type like creator type 
  54. aliasSize                 ds.w    1                ; offset: $4 (4)        ;  alias record size in bytes, for appl usage 
  55. sizeof                     EQU *                    ; size:   $6 (6)
  56.                         ENDR
  57. ; typedef struct AliasRecord *            AliasPtr
  58.  
  59. ; typedef AliasPtr *                    AliasHandle
  60.  
  61. ;  alias record information type 
  62. ; typedef short                         AliasInfoType
  63.  
  64. ;   create a new alias between fromFile-target and return alias record handle  
  65. ;
  66. ; pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  67. ;
  68.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  69.         Macro
  70.         _NewAlias
  71.             moveq               #2,D0
  72.             dc.w                $A823
  73.         EndM
  74.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  75.         IMPORT_CFM_FUNCTION NewAlias
  76.     ENDIF
  77.  
  78. ;  create a minimal new alias for a target and return alias record handle 
  79. ;
  80. ; pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  81. ;
  82.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  83.         Macro
  84.         _NewAliasMinimal
  85.             moveq               #8,D0
  86.             dc.w                $A823
  87.         EndM
  88.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  89.         IMPORT_CFM_FUNCTION NewAliasMinimal
  90.     ENDIF
  91.  
  92. ;  create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  
  93. ;
  94. ; pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  95. ;
  96.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  97.         Macro
  98.         _NewAliasMinimalFromFullPath
  99.             moveq               #9,D0
  100.             dc.w                $A823
  101.         EndM
  102.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  103.         IMPORT_CFM_FUNCTION NewAliasMinimalFromFullPath
  104.     ENDIF
  105.  
  106. ;  given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. 
  107. ;
  108. ; pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  109. ;
  110.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  111.         Macro
  112.         _ResolveAlias
  113.             moveq               #3,D0
  114.             dc.w                $A823
  115.         EndM
  116.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  117.         IMPORT_CFM_FUNCTION ResolveAlias
  118.     ENDIF
  119.  
  120. ;  given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. 
  121. ;
  122. ; pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  123. ;
  124.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  125.         Macro
  126.         _GetAliasInfo
  127.             moveq               #7,D0
  128.             dc.w                $A823
  129.         EndM
  130.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  131.         IMPORT_CFM_FUNCTION GetAliasInfo
  132.     ENDIF
  133.  
  134.  
  135. ;
  136. ; pascal OSErr IsAliasFile(const FSSpec *fileFSSpec, Boolean *aliasFileFlag, Boolean *folderFlag)
  137. ;
  138.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  139.         Macro
  140.         _IsAliasFile
  141.             moveq               #42,D0
  142.             dc.w                $A823
  143.         EndM
  144.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  145.         IMPORT_CFM_FUNCTION IsAliasFile
  146.     ENDIF
  147.  
  148. ;
  149. ; pascal OSErr ResolveAliasWithMountFlags(const FSSpec *fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged, unsigned long mountFlags)
  150. ;
  151.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  152.         Macro
  153.         _ResolveAliasWithMountFlags
  154.             moveq               #43,D0
  155.             dc.w                $A823
  156.         EndM
  157.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  158.         IMPORT_CFM_FUNCTION ResolveAliasWithMountFlags
  159.     ENDIF
  160.  
  161. ;  
  162. ;  Given a file spec, return target file spec if input file spec is an alias.
  163. ;  It resolves the entire alias chain or one step of the chain.  It returns
  164. ;  info about whether the target is a folder or file; and whether the input
  165. ;  file spec was an alias or not. 
  166. ;
  167.  
  168. ;
  169. ; pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  170. ;
  171.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  172.         Macro
  173.         _ResolveAliasFile
  174.             moveq               #12,D0
  175.             dc.w                $A823
  176.         EndM
  177.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  178.         IMPORT_CFM_FUNCTION ResolveAliasFile
  179.     ENDIF
  180.  
  181.  
  182. ;
  183. ; pascal OSErr ResolveAliasFileWithMountFlags(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased, unsigned long mountFlags)
  184. ;
  185.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  186.         Macro
  187.         _ResolveAliasFileWithMountFlags
  188.             moveq               #41,D0
  189.             dc.w                $A823
  190.         EndM
  191.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION ResolveAliasFileWithMountFlags
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  199.         Macro
  200.         _FollowFinderAlias
  201.             moveq               #15,D0
  202.             dc.w                $A823
  203.         EndM
  204.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  205.         IMPORT_CFM_FUNCTION FollowFinderAlias
  206.     ENDIF
  207.  
  208. ;  
  209. ;   Low Level Routines 
  210. ;
  211.  
  212. ;  given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. 
  213. ;
  214. ; pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  215. ;
  216.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  217.         Macro
  218.         _UpdateAlias
  219.             moveq               #6,D0
  220.             dc.w                $A823
  221.         EndM
  222.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  223.         IMPORT_CFM_FUNCTION UpdateAlias
  224.     ENDIF
  225.  
  226.  
  227.  
  228. ;   Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag 
  229. ;
  230. ; pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  231. ;
  232.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  233.         Macro
  234.         _MatchAlias
  235.             moveq               #5,D0
  236.             dc.w                $A823
  237.         EndM
  238.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  239.         IMPORT_CFM_FUNCTION MatchAlias
  240.     ENDIF
  241.  
  242.  
  243.  
  244.     ENDIF ; __ALIASES__ 
  245.  
  246.